import request from '@/utils/request'

// =====================================================================================================================
// 列表渲染和搜索
export const getEquipSearch = (params) => {
  return request({
    url: '/api/vm-service/vm/search',
    params
  })
}
// ------------------------

// 新建-------
// 售货机列表
export const getEquipType = (params) => {
  return request({
    url: '/api/vm-service/vmType/search',
    params
  })
}
// 选择点位
export const getEquipArea = (params) => {
  return request({
    url: '/api/vm-service/node/search',
    params
  })
}
// 新建确认
export const buildEquip = (data) => {
  return request({
    url: '/api/vm-service/vm',
    method: 'post',
    data
  })
}
// 新建结束-------------

// 批量筛选获取---------------
export const policyEquip = (params) => {
  return request({
    url: '/api/vm-service/policy',
    method: 'get',
    params
  })
}
// 批量筛选确认
export const policySure = (data) => {
  return request({
    url: '/api/vm-service/vm/applyPolicy',
    method: 'put',
    data
  })
}

// ----------------------------

// 查询售货机策略
// 获取当前策略情况
export const getStrategy = (id) => {
  return request({
    url: '/api/vm-service/policy/vmPolicy/' + id,
    method: 'get'
  })
}

// 取消策略
export const cancelStrategy = (innerCode, policyId) => {
  return request({
    url: '/api/vm-service/vm/cancelPolicy/' + innerCode + '/' + policyId,
    method: 'put'
  })
}

// 应用策略
export const setStrategy = (data) => {
  return request({
    url: '/api/vm-service/vm/applyPolicy',
    method: 'put',
    data
  })
}
// --------------------------------------------------------------------------

// 修改列表获取
export const reviseList = (params) => {
  return request({
    url: '/api/vm-service/node/search',
    method: 'get',
    params
  })
}
// 确认提交修改列表
export const reviseSubmit = (id, nodeId) => {
  return request({
    url: '/api/vm-service/vm/' + id + '/' + nodeId,
    method: 'put'
  })
}

// 货道--------------------------------------------------------------------------
// 获取售货机详情
export const equipNews = (typeId) => {
  return request({
    url: '/api/vm-service/vmType/' + typeId,
    method: 'get'
  })
}
// 货品详情

export const goodsNews = (innerCode) => {
  return request({
    url: '/api/vm-service/channel/channelList/' + innerCode,
    method: 'get'
  })
}
// 智能排序
// 商圈列表
export const shoppingList = (businessId) => {
  return request({
    url: '/api/vm-service/businessType/name/' + businessId,
    method: 'get'
  })
}
// 前十的销量
export const shoppingTen = (businessId) => {
  return request({
    url: '/api/vm-service/sku/businessTop10/' + businessId,
    method: 'get'
  })
}
// 添加查询
export const getAddSearch = (params) => {
  return request({
    url: '/api/vm-service/sku/search',
    params
  })
}

// ----
// 货道确认
export const huodaoSure = (data) => {
  return request({
    url: '/api/vm-service/channel/channelConfig',
    method: 'put',
    data
  })
}
// ================================================================================================================================================================
